<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/back.css" />
<script type="text/javascript">
	function checkClass(){
		var name = document.getElementById("className").value;
		if(name == ""){
			alert("要修改的类别不能为空...");
			return false;
		}
		return true;
}
</script>
<center>
	<span>类别修改</span>
	<form action="${pageContext.request.contextPath}/ClassServlet?service=modify" method="post" onsubmit="return checkClass();">
		<table width="500px" border="1" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#0066cc">
			<tr>
				<td>
					<table align="center">
					<tbody>
						<c:if test="${class != null}">
							<tr>
								<td>请输入类别名称：<input type="text" id="className" name="className" value="${class.className}"><span style="color:red;">*</span></td>
								<input type="hidden" name="classId" value="${class.classId}">
							</tr>
						</c:if>
					</tbody>
					<tbody>
						<c:if test="${item != null}">
							<tr>
								<td>请输入类别名称：<input type="text" id="itemName" name="className" value="${item.itemName}"><span style="color:red;">*</span></td>
											  <input type="hidden" name="classId" value="${item.itemId}">
							</tr>
							<tr>
								<td>请选择所属类别：
									<select name="parentId">
										<c:forEach items="${classlist}" var="cl">
											<option value="${cl.classId}" <c:if test="${item.parentId == cl.classId}">selected="selected"</c:if>>${cl.className}</option>
										</c:forEach>
									</select>
								</td>
							</tr>
						</c:if>
					</tbody>
					<tr align="center">
						<td>
							<input type="submit" value="提交">
							<input type="reset" value="重置">
						</td>
					</tr>
					</table>
				</td>
			</tr>
		</table>
	</form>
</center>